Array.prototype.randomItem = function () {
  return this[Math.floor(Math.random() * this.length)];
}

// 全局变量
const KoalaConfig = {
  capacity: 8 * 4,
  bgImage: new Image(),
}

function getConfig() {
  return KoalaConfig;
}

// 初始化壁纸
function refreshWallPaper() {
  const kinds = ["美女", "二次元", "风景", "呆萌酱"];
  const url = `https://api.66mz8.com/api/rand.acg.php?type=${kinds.randomItem()}&format=json`;
  fetch(url).then(res => res.json())
    .then(res => {
      KoalaConfig.bgImage.src = res.pic_url;
    });
}

(function () {
  refreshWallPaper();
})()


